#!/usr/bin/env python
# encoding: utf-8
"""
@summary: 使用urllib解析ip地址
@author: hongxingfan
@since: 2014年8月15日    下午3:36:28
"""
import sys

if __name__ == "__main__":
    
    result_hash = {}
    
    for line in sys.stdin:
        line = line.strip()
        cols = line.split("\t")
        key = cols[0]
        pv = int(cols[1])
        
        if key in result_hash:
            result_hash[key] += pv
        else:
            result_hash[key] = pv
    # 输出
    for (k, v) in result_hash.items():
        print("%s\t%d" % (k, v))
